package com.example.springevent.observer;

import java.util.Observable;
import java.util.Observer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.example.springevent.event.bo.IvdAddedEventBO;
import com.example.springevent.event.bo.IvdRemovedEventBO;

public class IvdChangedObserverPoHandler implements Observer {

	private static final Logger log = LoggerFactory.getLogger(IvdChangedObserverPoHandler.class);

	@Override
	public void update(Observable o, Object arg) {
		if (arg instanceof IvdAddedEventBO) {
			IvdAddedEventBO ivd = (IvdAddedEventBO) arg;
			log.info("订单[{}]增加核销金额[{}]", ivd.getPoCode(), ivd.getVerifyAmt());
		} else if (arg instanceof IvdRemovedEventBO) {
			IvdRemovedEventBO ivd = (IvdRemovedEventBO) arg;
			log.info("订单[{}]增加核销金额[{}]", ivd.getPoCode(), ivd.getVerifyAmt().negate());
		}
	}

}
